expansion of trinomial terms